package com.project.order.controller;

import com.project.common.RespResult;
import com.project.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: seata-at
 * @description: 订单处理
 * @author: mml
 * @create: 2023/12/19
 */

@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    private OrderService orderService;

    @PostMapping("/create")
    public RespResult createOrder(String account, String projectId, Integer count){
        boolean order = orderService.createOrder(account, projectId, count);
        if (order) {
            return RespResult.success("下单成功");
        }
        return RespResult.error("下单失败");
    }
}
